package k.index.Controller.feign;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.yc.bean.Result;
import k.daimai.entity.DmCategory;
import k.daimai.entity.DmProduct;
import k.daimai.entity.DmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
// 一个服务只能定义一个接口
@FeignClient(name = "cloud-order",fallback = OrderHystrix.class)
public interface OrderFeign {

    @RequestMapping("product/hots")
    List<DmProduct> queryHots() throws JsonProcessingException;
    @RequestMapping("category/getCategorys")
    List<DmCategory> queryCategories();

    /// //////////////////////////////
    @RequestMapping("feign/add")
    int add(@RequestParam("a") int a,@RequestParam("b")int b) ;
    @RequestMapping("feign/getResult")
    Result getResult(@SpringQueryMap Result result) ;
    @RequestMapping("feign/user")
    DmUser getDmUser(DmUser user,@RequestParam("myname") String myname) ;
    @RequestMapping("feign/hello")
    String hello(@RequestParam("name") String name) ;
}